package com.yq.thread777;

/**
 * thread
 *
 * @author 3307235355@qq.com
 * @since 2022/06/26 21:19
 */
public class Demo01  extends Thread{

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            //getname获取当前线程的名字
            System.out.println(getName()+" "+i);
        }
    }

    public static void main(String[] args) {
        // new Demo01().start();

        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName()+" "+i);
            if (i==20){
                new Demo01().start();
                new Demo01().start();
            }

        }
    }
}
